﻿using System;
using System.IO;
using System.Security.Cryptography;

class Sha1Demo
{
    private const string INPUT_FILENAME = @"..\..\data.txt";

    private static byte[] GetSha1Hash(string inputFileName)
    {
        SHA1 crypter = SHA1.Create();
        FileStream byteStream = new FileStream(inputFileName, FileMode.Open, FileAccess.Read);
        byte[] hashResult;
        using (byteStream)
        {
            hashResult = crypter.ComputeHash(byteStream);
        }
        return hashResult;
    }

    public static void Main()
    {
        byte[] hashResult = GetSha1Hash(INPUT_FILENAME);
        foreach (byte b in hashResult)
        {
            Console.Write("{0:X2} ", b);
        }
        Console.WriteLine();
    }
}
